<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>主生产计划列表</title>
    <script>
        $(function () {
            var pageNumber=4;
            var thispages=1;
            scjhListPage(pageNumber,thispages);
            $("#likeSelect").click(function () {
             LikescjhListPage(pageNumber,thispages);
            });
        });

        function scjhListPage(pageNumber,thispages){
            $.get("/scgl_scjhListselect_byLimit?pageN="+pageNumber+"&thispageN="+thispages,null,
                function (data) {
                    $("#scgl_scjhList_secondtable").html("");
                    for(var i=0;i<data.scglScjhs.length;i++) {
                        var html="<tr>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\"><a href=\"/#/page/scgl/scgl_scjhxiangxi.html?scglScjhDocumentnum="+data.scglScjhs[i].scglScjhDocumentnum+"\">"+data.scglScjhs[i].scglScjhDocumentnum+"</a></td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhSubject+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\"><a href=\"\">"+data.scglScjhs[i].scglScjhPersonincharge+"</a></td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhProject+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhAllproductionnum+"</td>\n";
                        if(data.scglScjhs[i].scglScjhBillsstatus==1){
                            var xinxi="未执行";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        if(data.scglScjhs[i].scglScjhBillsstatus==2){
                            var xinxi="正在执行";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        if(data.scglScjhs[i].scglScjhBillsstatus==3){
                            var xinxi="已执行";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        html+=" <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhDocumentdate+"</td>\n";
                        if(data.scglScjhs[i].scglScjhConfirmdate==null||data.scglScjhs[i].scglScjhConfirmdate==""){
                            var xinxi="";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n" ;
                        }

                        if (!data.scglScjhs[i].scglScjhConfirmdate==""){

                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhConfirmdate+"</td>";
                        }
                        if(data.scglScjhs[i].scglScjhStatus==1){
                            var xinxi="待审核";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"(<a href=\"/#/page/scgl/scgl_scjhxiangxi.html?scglScjhDocumentnum="+data.scglScjhs[i].scglScjhDocumentnum+"\">去审核</a>)</td>\n";
                        }
                        if(data.scglScjhs[i].scglScjhStatus==2){
                            var xinxi="审核通过";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhRemarks+"</td>\n" +
                            "</tr>";
                        $("#scgl_scjhList_secondtable").append(html)
                    }
                    page(data.thispageN,data.allpage,data.pageN);
                });
        }
        function LikescjhListPage(pageNumber,thispages){
            var scgl_scjh_documentNum=$("#scgl_scjh_documentNum").val();
            var scgl_scjh_personInCharge=$("#scgl_scjh_personInCharge").val();
            var scgl_scjh_project=$("#scgl_scjh_project").val();
            var scgl_scjh_status=$("#scgl_scjh_status").val();
            var scgl_scjh_billsStatus=$("#scgl_scjh_billsStatus").val();
            $.get("/scgl_LikescjhListselect_byLimit?pageN="+pageNumber+"&thispageN="+thispages
                +"&scgl_scjh_documentNum="+scgl_scjh_documentNum
                +"&scgl_scjh_personInCharge="+scgl_scjh_personInCharge
                +"&scgl_scjh_project="+scgl_scjh_project
                +"&scgl_scjh_status="+scgl_scjh_status
                +"&scgl_scjh_billsStatus="+scgl_scjh_billsStatus
                , null,
                function (data) {
                console.log(data);
                    $("#scgl_scjhList_secondtable").html("");
                    for(var i=0;i<data.scglScjhs.length;i++) {
                        var html="<tr>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\"><a href=\"/#/page/scgl/scgl_scjhxiangxi.html?scglScjhDocumentnum="+data.scglScjhs[i].scglScjhDocumentnum+"\">"+data.scglScjhs[i].scglScjhDocumentnum+"</a></td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhSubject+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\"><a href=\"\">"+data.scglScjhs[i].scglScjhPersonincharge+"</a></td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhProject+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhAllproductionnum+"</td>\n";
                        if(data.scglScjhs[i].scglScjhBillsstatus==1){
                            var xinxi="未执行";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        if(data.scglScjhs[i].scglScjhBillsstatus==2){
                            var xinxi="正在执行";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        if(data.scglScjhs[i].scglScjhBillsstatus==3){
                            var xinxi="已执行";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        html+=" <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhDocumentdate+"</td>\n";
                        if(data.scglScjhs[i].scglScjhConfirmdate==null||data.scglScjhs[i].scglScjhConfirmdate==""){
                            var xinxi="";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n" ;
                        }

                        if (!data.scglScjhs[i].scglScjhConfirmdate==""){

                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhConfirmdate+"</td>";
                        }
                        if(data.scglScjhs[i].scglScjhStatus==1){
                            var xinxi="待审核";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"(<a href=\"/#/page/scgl/scgl_scjhxiangxi.html?scglScjhDocumentnum="+data.scglScjhs[i].scglScjhDocumentnum+"\">去审核</a>)</td>\n";
                        }
                        if(data.scglScjhs[i].scglScjhStatus==2){
                            var xinxi="审核通过";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+xinxi+"</td>\n";
                        }
                        html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhs[i].scglScjhRemarks+"</td>\n" +
                            "</tr>";
                        $("#scgl_scjhList_secondtable").append(html)
                    }
                    page1(data.thispageN,data.allpage,data.pageN);
                });
        }



        //页码函数
        function page(thispage,allpage,pageNu) {
            $("#pageli").html("");
            $("#pageli").append("<li class=\"li112\" id=\"firPage\">首页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"upPage\">上一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"thisP\">"+thispage+"</li>");
            $("#pageli").append("<li class=\"li112\" id=\"nextPage\">下一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"lastPage\">共"+allpage+"页</li>");
            $("#pageli").append("<li class=\"li112\">到第<input type=\"text\" style=\"width: 30px\" id=\"tiao\" value=\""+thispage+"\" onmouseover=\"this.select()\" />页</li>");
            $("#pageli").append("<li class=\"li112\"><input type=\"button\" value=\"确认\" id=\"queren\" style=\"font-size: 13px;color: #444444;\"/></li>");

            //首页的点击事件
            $("#firPage").click(function() {
                thispages=1;
                scjhListPage(pageNu,thispages);
            });
            //上一页点击事件
            $("#upPage").click(function() {
                if(thispage>1){
                    thispage=thispage-1;
                    scjhListPage(pageNu,thispage);
                }
            });
            //下一页点击事件
            $("#nextPage").click(function() {
                if(thispage<allpage){
                    thispage=thispage+1;
                    scjhListPage(pageNu,thispage);
                }
            });
            //确认的点击事件
            $("#queren").click(function() {
                if($("#tiao").val()<=allpage&&$("#tiao").val()>0){
                    thispage=$("#tiao").val()
                    scjhListPage(pageNu,thispage);
                }
                if($("#tiao").val()>allpage){
                    thispage=allpage;
                    $("#tiao").val(allpage);
                    scjhListPage(pageNu,thispage);
                }
            });
        }
        //模糊页码函数
        function page1(thispage,allpage,pageNu) {
            $("#pageli").html("");
            $("#pageli").append("<li class=\"li112\" id=\"firPage\">首页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"upPage\">上一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"thisP\">"+thispage+"</li>");
            $("#pageli").append("<li class=\"li112\" id=\"nextPage\">下一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"lastPage\">共"+allpage+"页</li>");
            $("#pageli").append("<li class=\"li112\">到第<input type=\"text\" style=\"width: 30px\" id=\"tiao\" value=\""+thispage+"\" onmouseover=\"this.select()\" />页</li>");
            $("#pageli").append("<li class=\"li112\"><input type=\"button\" value=\"确认\" id=\"queren\" style=\"font-size: 13px;color: #444444;\"/></li>");

            //首页的点击事件
            $("#firPage").click(function() {
                thispages=1;
                LikescjhListPage(pageNu,thispages);
            });
            //上一页点击事件
            $("#upPage").click(function() {
                if(thispage>1){
                    thispage=thispage-1;
                    LikescjhListPage(pageNu,thispage);
                }
            });
            //下一页点击事件
            $("#nextPage").click(function() {
                if(thispage<allpage){
                    thispage=thispage+1;
                    LikescjhListPage(pageNu,thispage);
                }
            });
            //确认的点击事件
            $("#queren").click(function() {
                if($("#tiao").val()<=allpage&&$("#tiao").val()>0){
                    thispage=$("#tiao").val()
                    LikescjhListPage(pageNu,thispage);
                }
                if($("#tiao").val()>allpage){
                    thispage=allpage;
                    $("#tiao").val(allpage);
                    LikescjhListPage(pageNu,thispage);
                }
            });
        }
        layui.use('form', function(){
            var form = layui.form
            form.render();

        });

    </script>
    <style>
        .li112{
            float:left;
            margin-left:14px;
            font-size: 16px;
            cursor:pointer;
        }
        .scgl_scjhList_firsttable {
            width: 100%;
            height: 30px;
            border:slategray 2px solid ;
            text-align: center;
        }

        .scgl_scjhList_firsttable tr {
            border-bottom: 2px solid slategray;
        }
        .scgl_scjhList_firsttable_tr_td {
            background-color: #FFFFF0;
            border-right: 2px solid slategray;
            width: 10%;
            height: 30px;
        }
        .scgl_scjhList_firsttable01_tr_td {
            border-right: 2px solid slategray;
            width: 10%;
            height: 30px;
        }
        .scgl_scjhList_secondtable {
            text-align: center;
            width: 100%;
            height: 30px;
            border:slategray 2px solid ;
        }
    </style>
</head>
<body>
<!--页面主题-->
<div style="height: 50px;width: 100%; font-weight: bold;text-align: center;font-size: 30px">主生产计划列表</div>

<fieldset class="table-search-fieldset">
    <legend>搜索信息</legend>
    <div style="margin: 10px 10px 10px 10px">
        <form class="layui-form layui-form-pane" >
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">单据编号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="scgl_scjh_documentNum" name="scgl_scjh_documentNum" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">负责人</label>
                    <div class="layui-input-inline">
                        <input  type="text" id="scgl_scjh_personInCharge" name="scgl_scjh_personInCharge" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">项目</label>
                    <div class="layui-input-inline">
                        <input   type="text" id="scgl_scjh_project"  name="scgl_scjh_project" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">审批状态</label>
                    <div class="layui-input-inline">
                        <select id="scgl_scjh_status"  name="scgl_scjh_status">
                            <option value="">请选择状态</option>
                            <option value="未审批" >未审批</option>
                            <option value="已审批">已审批</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">单据状态</label>
                    <div class="layui-input-inline">
                        <select id="scgl_scjh_billsStatus"  name="scgl_scjh_billsStatus">
                            <option value="">请选择状态</option>
                            <option value="未执行" >未执行</option>
                            <option value="正在执行">正在执行</option>
                            <option value="已执行">已执行</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <button type="button" id="likeSelect" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                </div>
            </div>
        </form>
    </div>
</fieldset>
<div style="margin-top: 20px">
    <button type="button" id="scgl_scjh_orderadd" class="layui-btn layui-btn-normal layui-btn-radius">添加</button>
</div>
<!--</div>-->
<!--/页面主题-->
<!--详细展示-->
<div class="scgl_scjhList_firstdiv"  style="width: 100%;height: 500px;margin-top: 20px">
    <table class="scgl_scjhList_firsttable" cellpadding="0px" cellspacing="0px" border="2px">
        <tr>
            <td class="scgl_scjhList_firsttable_tr_td">单据编号</td>
            <td class="scgl_scjhList_firsttable_tr_td">主题</td>
            <td class="scgl_scjhList_firsttable_tr_td">负责人</td>
            <td class="scgl_scjhList_firsttable_tr_td">项目</td>
            <td class="scgl_scjhList_firsttable_tr_td">生产计划数量总量</td>
            <td class="scgl_scjhList_firsttable_tr_td">单据状态</td>
            <td class="scgl_scjhList_firsttable_tr_td">制单日期</td>
            <td class="scgl_scjhList_firsttable_tr_td">确认日期</td>
            <td class="scgl_scjhList_firsttable_tr_td">审批状态</td>
            <td class="scgl_scjhList_firsttable_tr_td">备注</td>
        </tr>
    </table>

    <table id="scgl_scjhList_secondtable"  class="scgl_scjhList_secondtable" cellpadding="0px" cellspacing="0px" border="2px">

    </table>
    <div class='pages_bar' style="margin-left:400px;margin-top: 20px">
        <ul id="pageli"></ul>
    </div>
</div>
</body>
</html>